﻿namespace Universe.MediaProbe
{
    using System;
    using System.Collections.Generic;

    [Serializable]
    public class ProbeReport
    {
        public string FullName { get; set; }
        
        // When Error is Not Null, all the another fields are default
        public ErrorInfo Error { get; set; }
        public string Format { get; set; }
        public string FormatLongName { get; set; }
        public decimal Duration { get; set; }
        public decimal BitRate { get; set; }

        public List<VideoInfo> Videos = new List<VideoInfo>();
        public List<AudioInfo> Audios = new List<AudioInfo>();
        public List<SubInfo> Subs = new List<SubInfo>();

        public bool HasVideo
        {
            get { return Videos != null && Videos.Count > 0; }
        }

        public bool HasAudio
        {
            get { return Audios != null && Audios.Count > 0; }
        }

        public bool HasSubTitles
        {
            get { return Subs != null && Subs.Count > 0; }
        }

        [Serializable]
        public class ErrorInfo
        {
            public int Number { get; set; }
            public string Description { get; set; }
        }

        [Serializable]
        public class VideoInfo
        {
            public int IdStream { get; set; }
            public string Codec { get; set; }
            public string CodecLongName { get; set; }
            public decimal FrameRate { get; set; }
            public int Width { get; set; }
            public int Height { get; set; }
        }

        [Serializable]
        public class AudioInfo
        {
            public int IdStream { get; set; }
            public string Codec { get; set; }
            public string CodecLongName { get; set; }
            public decimal SampleRate { get; set; }
            public decimal BitRate { get; set; }
            public int Channels { get; set; }
            public string Language { get; set; }
        }

        [Serializable]
        public class SubInfo
        {
            public int IdStream { get; set; }
            public string Codec { get; set; }
            public string CodecLongName { get; set; }
            public string Language { get; set; }
        }
    }
}
